import 'package:flutter/material.dart';

class LeftPanel extends StatefulWidget {
  const LeftPanel({super.key});

  @override
  State<StatefulWidget> createState() => _LeftPanelState();
}

class _LeftPanelState extends State<LeftPanel> {
  List<bool> expanded_list = [false, false];
  @override
  Widget build(BuildContext context) {
    return Container(
      width: 250,
      decoration:const BoxDecoration(
        border: Border(right: BorderSide(color: Colors.white))
      ),
      child: Column(
        children: [
          Padding(
            padding: const EdgeInsets.all(10),
            child: Row(
              children: [
                Image.asset('assets/images/icon.png', width: 80),
                const SizedBox(width: 10),
                const Text(
                  "lyps",
                  style: TextStyle(fontSize: 50, color: Colors.white),
                ),
              ],
            ),
          ),
          const ListTile(
            textColor: Colors.white,
            iconColor: Colors.white,
            title: Text("在线音乐"),
            minLeadingWidth: 0,
            leading: Icon(IconData(0xe60d, fontFamily: 'iconfont'), size: 15),
          ),
          ExpansionPanelList(
            dividerColor: Colors.transparent,
            elevation: 0,
            expandIconColor: Colors.white,
            expansionCallback: (panelIndex, isExpanded) {
              setState(() {
                expanded_list[panelIndex] = isExpanded;
              });
            },
            children: [
              ExpansionPanel(
                isExpanded: expanded_list[0],
                backgroundColor: Colors.transparent,
                headerBuilder: (context, isExpanded) {
                  return const ListTile(
                    title: Text("我的音乐"),
                    textColor: Colors.white,
                    iconColor: Colors.white,
                    minLeadingWidth: 0,
                    leading: Icon(
                      IconData(0xe610, fontFamily: 'iconfont'),
                      size: 15,
                    ),
                  );
                },
                body: const Padding(
                  padding: EdgeInsets.only(left: 30),
                  child: Column(
                    children: [
                      ListTile(
                        title: Text("我喜欢"),
                        titleTextStyle: TextStyle(fontSize: 14),
                        textColor: Colors.white,
                        iconColor: Colors.white,
                        minLeadingWidth: 0,
                        leading: Icon(
                          IconData(0xe7aa, fontFamily: 'iconfont'),
                          size: 15,
                        ),
                      ),
                      ListTile(
                        title: Text("本地和下载"),
                        titleTextStyle: TextStyle(fontSize: 14),
                        textColor: Colors.white,
                        iconColor: Colors.white,
                        minLeadingWidth: 0,
                        leading: Icon(
                          IconData(0xe6bc, fontFamily: 'iconfont'),
                          size: 15,
                        ),
                      ),
                      ListTile(
                        title: Text("最近播放"),
                        titleTextStyle: TextStyle(fontSize: 14),
                        textColor: Colors.white,
                        iconColor: Colors.white,
                        minLeadingWidth: 0,
                        leading: Icon(
                          IconData(0xe676, fontFamily: 'iconfont'),
                          size: 15,
                        ),
                      ),
                    ],
                  ),
                ),
              ),
              ExpansionPanel(
                isExpanded: expanded_list[1],
                backgroundColor: Colors.transparent,
                headerBuilder: (context, isExpanded) {
                  return const ListTile(
                    title: Text("我的歌单"),
                    textColor: Colors.white,
                    iconColor: Colors.white,
                    minLeadingWidth: 0,
                    leading: Icon(IconData(0xe61b, fontFamily: 'iconfont'), size: 15),
                  );
                },
                body: Text("data"),
              )
            ],
          ),
          const ListTile(
            textColor: Colors.white,
            iconColor: Colors.white,
            title: Text("创建歌单"),
            minLeadingWidth: 0,
            leading: Icon(Icons.add, size: 15),
          ),
        ],
      ),
    );
  }
}
